<?php
/**
 * TestGuest Version1.0
 * ================================================
 * Copy 2017-2018 zxj
 * Web: http://www.zhaoxiaojie.club
 * ================================================
 * Author: Zxj
 * Date: 17/8/14
 * Time: 上午11:35
 *
 *  回复处理页面
 *  接收表单传过来的数据,然后处理
 *
 */
session_start();
//引入核心文件
include_once 'common/ini.php';
include_once 'common/mysql.inc.php';
include_once 'common/function.inc.php';


//判断是否为正常请求

    if(!isset($_POST['submit'])){


        _alert_back('请求异常!');

    }


//接收数据并写入数据库

    $nid = _guo_lv($_POST['nid']);
    $content = _guo_lv($_POST['content']);
    if(isset($_SESSION['pro_username'])){

        $username = _guo_lv($_SESSION['pro_username']);

    }else{

        $username = '匿名用户';

    }

    $addtime = date('Y-m-d H:i:s');

  //写入数据库

    $sql = "insert into bbs_reply VALUES (null,$nid,'$content','$username','$addtime')";
    $res = mysql_query($sql);
    if($res&&mysql_affected_rows()>0){

        echo '<script>alert("回复成功!");window.location.href="show.php?id='.$nid.'";</script>';

    }else{

        _alert_back('添加失败!');

    }

?>